package com.learn.algorithm.designpattern.strategy;

import java.util.Arrays;

/**
 * 策略模式
 * @author wangxing
 * @version 2020/8/19 22:46 Administrator
 */
public class LearnStrategy {

    public static void main(String[] args) {
        Person person = new Person(30, 180, 100);
        Person person2 = new Person(29 , 160, 50);
        Person person3 = new Person(50 , 159, 65);
        Person[] people = {person, person2, person3};
        Arrays.sort(people,new PersonAgeComparator());
        System.out.println(Arrays.toString(people));
        Arrays.sort(people,new PersonHeightComparator());
        System.out.println(Arrays.toString(people));
        Arrays.sort(people,new PersonWeightComparator());
        System.out.println(Arrays.toString(people));
    }
}
